<?php
/**
 * Created by PhpStorm.
 * User: tjjs
 * Date: 17-8-10
 * Time: 上午11:21
 */

namespace ActionsHttp;


use Data\Account_flow_DAO;
use Data\Order_form_DAO;
use Data\Restaurant_withdraws_DAO;

class RestaurantAccountInfo extends BaseActionHttp
{
    public function doAction() {
        parent::doAction();
        // 商铺id
        $restaurant_id = $_SESSION[RESTAURANT_ID];
        $restaurant_id = 1;
        // 已入帐金额
        $account_entry = Account_flow_DAO::getLastRecordByRestauranId($restaurant_id);
        $account_left = 0;
        if ($account_entry) {
            $account_left = $account_entry->getACCOUNT_LEFT();
        }
        // 未入帐金额
        $account_not_entry = Order_form_DAO::getSumOrderPriceNotEntry($restaurant_id);

        // 正在进行中的提现金额
        $withdraws_amount_ing = Restaurant_withdraws_DAO::getRecordByRestaurantId($restaurant_id);

        // 返回数据
        $this->setValue(ACCOUNT_LEFT,$account_left);
        $this->setValue(ACCOUNT_NOT_ENTRY,$account_not_entry);
        $this->setValue(WITHDRAWS_AMOUNT_ING,$withdraws_amount_ing);
        $this->ResponseDataToCurrentClient();
    }
}